package com.glasses.controller;

import com.alibaba.fastjson.JSONObject;
import com.glasses.orm.base.Ex.BaseControllerEx;
import com.glasses.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

/**
 * Created by ashin on 2018/1/24.
 */
@Controller
@Scope("prototype")
@RequestMapping("/order")
public class OrderController extends BaseControllerEx {

    @Autowired
    OrderService orderService;

    @Override
    protected void init() {
        super.init(orderService);
    }

    @RequestMapping(value = "/doCancelOrder")
    public JSONObject doCancelOrder(@RequestParam Map map) throws Exception{
        return orderService.cancelOrder(map);
    }

    @RequestMapping(value = "/doAddOrder")
    public JSONObject doAddOrder(@RequestParam Map map) throws Exception{
        return orderService.addOrder(map);
    }

    @RequestMapping(value = "/doPay")
    public JSONObject doPay(@RequestParam Map map) throws Exception{
        return orderService.pay(map,request);
    }

    @RequestMapping(value = "/doGetOrderCountStatus")
    public JSONObject doGetOrderCountStatus(@RequestParam Map map) throws Exception{
        return orderService.getOrderCountStatus(map);
    }

    @RequestMapping(value = "/doGetCommodityStatusCount")
    public JSONObject doGetCommodityStatusCount(@RequestParam Map map) throws Exception{
        return orderService.getCommodityStatusCount(map);
    }

}
